package com.shreecon.lms.manager;

import com.shreecon.lms.interfaces.IMessageConstant;
import com.shreecon.lms.interfaces.LMSException;
import com.shreecon.lms.interfaces.persistance.EmployeeDAOFactory;
import com.shreecon.lms.interfaces.persistance.IEmployeeDAO;
import com.shreecon.lms.persistancy.hbm.EmployeeDetail;

public class EmployeeManagerValidator{

    protected void validateLoginDetail (String userName,String password) throws LMSException {
	IEmployeeDAO employeeDAO = EmployeeDAOFactory.getInstance().getEmployeeDAO();
	EmployeeDetail empDetail = employeeDAO.findByUserName(userName);
	if( empDetail == null ){
	    throw new LMSException(IMessageConstant.INVALID_USER_NAME);
	}else if( !empDetail.getEmpPassword().equals(password) ){
	    throw new LMSException(IMessageConstant.INVALID_PWD);
	}
	System.out.println("Data Valid");
    }
}
